<template>
  <app-nav />
  <div class="main">
    <div class="aside">
      <app-aside />
    </div>
    <div class="content">
      <router-view />
    </div>
  </div>
  <el-backtop :bottom="100">
    <div class="top">UP</div>
  </el-backtop>
</template>
<script>
import { mapMutations } from "vuex";
import AppNav from "@/components/AppNav";
import AppAside from "@/components/AppAside";
export default {
  name: "app",
  components: {
    AppNav,
    AppAside,
  },
  methods: { ...mapMutations(["updateUser"]) },
  async created() {
    let { data } = await this.$axios({
      //验证当前的用户是否登录
      method: "POST",
      url: "/login/isCheck",
    });
    if (data.code) return; //未登录
    //已登录
    this.updateUser(data.data); //将用户数据存入vuex中
  },
};
</script>
<style lang="less" >
body {
  background: url("./assets/images/background/bg-left.png") no-repeat 0 50px
      fixed,
    url("./assets/images/background/bg-right.png") no-repeat right 50px fixed;
  background-color: #f2f2f2;
}

// css隐藏滚动条
body::-webkit-scrollbar {
  width: 0 !important;
}
body {
  -ms-overflow-style: none;
} // IE 10+
body {
  overflow: -moz-scrollbars-none;
} // Firefox

.main {
  display: flex;
  max-width: 1200px;
  margin: 65px auto;
  padding: 0 20px;
  .aside {
    width: 270px;
    margin-right: 15px;
  }
  .content {
    max-width: 915px;
    min-height: 700px;
    flex: 1;
  }
}
.top {
  height: 100%;
  width: 100%;
  background-color: #f2f5f6;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.12);
  text-align: center;
  line-height: 40px;
  color: #1989fa;
}
</style>
